use steamworks::{Client, FriendFlags};

#[test]
fn get_app_owner() {
    let (client, _) = Client::init().unwrap();
    let apps = client.apps();
    let steam_id = apps.app_owner();
    let steam_id = steam_id.raw();
    println!("app_owner:{steam_id}");
}

#[test]
fn get_ip_country() {
    let (client, _) = Client::init().unwrap();
    let utils = client.utils();
    let string = utils.ip_country();
    println!("ip_country:{string}");
}

#[test]
fn test_get_server_real_time() {
    let (client, _) = Client::init().unwrap();
    let utils = client.utils();
    let string = utils.get_server_real_time();
    println!("get_server_real_time:{string}");
}

#[test]
fn test_request_lobby_list() {
    let (client, _) = Client::init().unwrap();
    let matchmaking = client.matchmaking();
    matchmaking.request_lobby_list(|result| {
        let lobby_list = result.unwrap();
        let lobby_list = lobby_list.iter().map(|s| s.raw());
        println!("request_lobby_list:{lobby_list:?}");
    });
}

#[test]
fn test1() {
    let (client, _) = Client::init().unwrap();
    let friends = client.friends();
    let friend_list = friends.get_friends(FriendFlags::IMMEDIATE);
    for f in friend_list {
        if !"法克鱿鱼圈"==f.name(){
            continue;
        }
        println!("friend_name:{}", f.name());
        // let steam_id = f.id();
        // let friend = friends.activate_game_overlay_to_user(steam_id);
        // friend.invite_user_to_game()
    }
}